<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh">
<head>
    <title>素材购买</title>
    <link rel="stylesheet" href="/static/css/vip.css" />
</head>
<body>
<div class="modal-vip">
    <div class="modal-vip-info">
        <div class="vip-info-top">
            欢迎您 <span>${user.userName!}</span>，&nbsp;
            您的可用现金 ￥<span>${userAccount.balance/100}</span>元&nbsp;
            <#if memberRecord??>
                您的 <span>${memberType.title!}</span>
                <#if memberRecord.endDate?date lt .now?date>
                    <span style="font-weight: bold;color: red">已经过期</span>
                <#else >
                    有效期至 ${memberRecord.endDate}
                </#if>
            </#if>
        </div>
        <ul class="vip-info-lists">
            <#list memberSales as memberSale>
                <li data-id="${memberSale.id}" data-price="${memberSale.price}" <#if defaultMember.id == memberSale.id>class="recommend-item active"</#if>>
                    <p class="vip-item_price">￥<span>${memberSale.price/100}</span>元</p>
                    <#if memberSale.price gt 0>
                        <p class="vip-item_coupon">限时特价</p>
                    </#if>
                    <p class="vip-item_intro">${memberSale.name!}</p>
                    <div class="vip-item_line"></div>
                    <div class="vip-item_desc">${memberSale.description!}</div>
                </li>
            </#list>
        </ul>
        <div class="vip-info-footer">
            <div class="profit-wrap">
                <h3>赚现金免费获得VIP</h3>
                <p><a href="#" target="_blank">分享课程</a>获得课程分成</p>
                <p><a href="#" target="_blank">上传作品</a>获得现金奖励</p>
                <p><a href="#" target="_blank">参与活动</a>获得VIP奖励</p>
            </div>
            <div class="pay-wrap">
                <div class="pay-money">应付金额 ￥<span id="current_price">${defaultMember.price/100}</span>元</div>
                <div class="pay-search" id="pay-use-weixin" style="display: none">
                    <div class="weixin-qrcode" id="qrcode-image">
                        <img src="/static/images/qr-code.png" style="width: 150px;height: 150px;">
                    </div>
                    <div class="weixin-words"><img src="/static/qdxwx/img/weixin.png" alt=""><span>微信扫码支付</span></div>
                </div>
                <div class="pay-money-asset" id="pay-use-money" style="display: block">
                    <div class="asset-count">账户余额 ￥<span style="color: red">${userAccount.balance/100}</span></div>
                    <a class="btn-pay-asset">确认支付</a>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/static/libs/jquery/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="/static/libs/layui-v2.6.8/layui.js"></script>
<script type="text/javascript" src="/static/libs/jquery/jquery.qrcode.min.js"></script>
<script type="text/javascript" src="/static/js/wxJSAPI.js"></script>
<script type="text/javascript" src="/static/js/order.js?v=1"></script>
<script type="text/javascript">
    var userId = ${userAccount.userId};
    var userMoney = ${userAccount.balance};
    var thisId = ${defaultMember.id};
    var thisPrice = ${defaultMember.price};
    //选择开通类型
    $(document).ready(function () {
        if (userId <=0 ) {
            return parent.location.href = "/auth/login.html";
        }
        $('.vip-info-lists li').on('click', function () {
            var thisLi = $(this);
            thisLi.addClass('active').siblings().removeClass('active');
            thisPrice = parseInt(thisLi.data("price"));
            thisId = parseInt(thisLi.data("id"));
            initVipOrder();
        });
        initVipOrder();
    });

    function initVipOrder() {
        $('#current_price').text(thisPrice / 100);
        $('#pay-use-money').css('display', 'block');
        $('#pay-use-weixin').css('display', 'none');
        if (userMoney >= thisPrice) {
            $('.btn-pay-asset').text('账户支付');
        } else {
            $('.btn-pay-asset').text('微信扫码支付');
        }
    }
    $('.btn-pay-asset').on('click', function () {
        payCreate(thisId,'MEMBER');
    });
</script>
</body>
</html>